#ifndef HEADER_FPE_H
#define HEADER_FPE_H

#include <openssl/aes.h>

# define FPE_ENCRYPT 1
# define FPE_DECRYPT 0

# define FF3_ROUNDS 8
# define FF3_TWEAK_SIZE 8

struct fpe_key_st {
    unsigned int radix;//随机值
    unsigned int tweaklen;//口令长度
    unsigned char *tweak;//口令
    AES_KEY aes_enc_ctx;//加密上下文
};

typedef struct fpe_key_st FPE_KEY;

int FPE_set_ff3_key(const unsigned char *userKey, const int bits, const unsigned char *tweak, const unsigned int radix, FPE_KEY *key);

void FPE_unset_ff3_key(FPE_KEY *key);

void FPE_ff3_encrypt(unsigned int *in, unsigned int *out, unsigned int inlen, FPE_KEY *key, const int enc);

#endif
